<template>
 <div>
   <h1>获取所有的教师</h1>
    <ul>
      <li v-for="item in all" :key="item._id">{{item.name}}</li>
    </ul>
 </div>
</template>

<script>
export default {
  data(){
    return{
      all:[]
    }
  },
  methods:{
    async getAllTeachers(){
      const {data:{data:{rows}}}=await this.$api.teachers.getTeachers()
      this.all=rows
    }
  },
  created(){
    this.getAllTeachers()
  }
}
</script>

<style>

</style>